/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package form;

import br.entidade.Acessos;
import form.administrador.JIAcao;
import form.administrador.JIGrupoUsuario;
import form.administrador.JIUsuario;
import form.input.JIAtendente;
import form.input.JIDePara;
import form.input.JINConformidade;
import form.input.JIMascara;
import form.input.JIStatus;
import form.input.JIUnidade;
import form.output.JIProducao;
import java.awt.Toolkit;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import javax.swing.JOptionPane;
import superior.sessao.Sessao;


/**
 *
 * @author Adriano
 */
public class JFPrincipal extends javax.swing.JFrame {
    private static final long serialVersionUID = 1L;
    
    public JFPrincipal() {
        initComponents();
        iniciarComponentes();
        this.setLocationRelativeTo(null);
        this.setIconImage(Toolkit.getDefaultToolkit().getImage(this.getClass().getResource("/imagens/logo464x387.png")));
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jMenuBar2 = new javax.swing.JMenuBar();
        jMenu4 = new javax.swing.JMenu();
        jMenu5 = new javax.swing.JMenu();
        jMenuItem1 = new javax.swing.JMenuItem();
        jPFundo = new javax.swing.JPanel();
        jPDisplay = new javax.swing.JPanel();
        conexaoLabel = new javax.swing.JLabel();
        usuarioLabel = new javax.swing.JLabel();
        dataLabel = new javax.swing.JLabel();
        jMenuBar1 = new javax.swing.JMenuBar();
        jMCadastro = new javax.swing.JMenu();
        jMAten = new javax.swing.JMenuItem();
        jMConv = new javax.swing.JMenuItem();
        jMInco = new javax.swing.JMenuItem();
        jMUnid = new javax.swing.JMenuItem();
        jMDepara = new javax.swing.JMenuItem();
        jMStatus = new javax.swing.JMenuItem();
        jMenu2 = new javax.swing.JMenu();
        jMInconsistencia = new javax.swing.JMenuItem();
        jMSubMenu = new javax.swing.JMenu();
        jMDecontos = new javax.swing.JMenuItem();
        jMCortesias = new javax.swing.JMenuItem();
        jMParticular = new javax.swing.JMenuItem();
        jMenu3 = new javax.swing.JMenu();
        jMUser = new javax.swing.JMenuItem();
        jSeparator1 = new javax.swing.JPopupMenu.Separator();
        jMAcao = new javax.swing.JMenuItem();
        jMPerfil = new javax.swing.JMenuItem();
        jMenu6 = new javax.swing.JMenu();
        jMenuItem2 = new javax.swing.JMenuItem();

        jMenu4.setText("File");
        jMenuBar2.add(jMenu4);

        jMenu5.setText("Edit");
        jMenuBar2.add(jMenu5);

        jMenuItem1.setText("jMenuItem1");

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Faturamento");
        setName("SFT PROJETO"); // NOI18N

        jPFundo.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        jPFundo.setName("SFT Projeto"); // NOI18N

        javax.swing.GroupLayout jPFundoLayout = new javax.swing.GroupLayout(jPFundo);
        jPFundo.setLayout(jPFundoLayout);
        jPFundoLayout.setHorizontalGroup(
            jPFundoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 1196, Short.MAX_VALUE)
        );
        jPFundoLayout.setVerticalGroup(
            jPFundoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 699, Short.MAX_VALUE)
        );

        jPDisplay.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        conexaoLabel.setText("conexao");
        conexaoLabel.setToolTipText("");

        usuarioLabel.setText("teste");
        usuarioLabel.setToolTipText("");

        dataLabel.setText("data");
        dataLabel.setToolTipText("");

        javax.swing.GroupLayout jPDisplayLayout = new javax.swing.GroupLayout(jPDisplay);
        jPDisplay.setLayout(jPDisplayLayout);
        jPDisplayLayout.setHorizontalGroup(
            jPDisplayLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPDisplayLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(usuarioLabel)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(conexaoLabel)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(dataLabel)
                .addContainerGap())
        );
        jPDisplayLayout.setVerticalGroup(
            jPDisplayLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPDisplayLayout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(jPDisplayLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(usuarioLabel)
                    .addComponent(conexaoLabel)
                    .addComponent(dataLabel))
                .addContainerGap())
        );

        jMCadastro.setMnemonic('C');
        jMCadastro.setText("Cadastro");
        jMCadastro.setToolTipText("");

        jMAten.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_A, java.awt.event.InputEvent.CTRL_MASK));
        jMAten.setMnemonic('A');
        jMAten.setText("Atendente");
        jMAten.setToolTipText("");
        jMAten.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMAtenActionPerformed(evt);
            }
        });
        jMCadastro.add(jMAten);
        jMAten.setEnabled(ativo("aten"));

        jMConv.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_C, java.awt.event.InputEvent.CTRL_MASK));
        jMConv.setMnemonic('C');
        jMConv.setText("Convenio");
        jMConv.setToolTipText("");
        jMConv.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMConvActionPerformed(evt);
            }
        });
        jMCadastro.add(jMConv);
        jMConv.setEnabled(ativo("masc"));

        jMInco.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_I, java.awt.event.InputEvent.CTRL_MASK));
        jMInco.setMnemonic('I');
        jMInco.setText("Inconsistencia");
        jMInco.setToolTipText("");
        jMInco.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMIncoActionPerformed(evt);
            }
        });
        jMCadastro.add(jMInco);
        jMInco.setEnabled(ativo("ncon"));

        jMUnid.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_U, java.awt.event.InputEvent.CTRL_MASK));
        jMUnid.setMnemonic('U');
        jMUnid.setText("Unidade");
        jMUnid.setToolTipText("");
        jMUnid.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMUnidActionPerformed(evt);
            }
        });
        jMCadastro.add(jMUnid);
        jMUnid.setEnabled(ativo("unid"));

        jMDepara.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_D, java.awt.event.InputEvent.CTRL_MASK));
        jMDepara.setText("Depara");
        jMDepara.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMDeparaActionPerformed(evt);
            }
        });
        jMCadastro.add(jMDepara);
        jMDepara.setEnabled(ativo("deCo"));

        jMStatus.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.CTRL_MASK));
        jMStatus.setText("Status");
        jMStatus.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMStatusActionPerformed(evt);
            }
        });
        jMCadastro.add(jMStatus);
        jMStatus.setEnabled(ativo("stat"));

        jMenuBar1.add(jMCadastro);

        jMenu2.setMnemonic('P');
        jMenu2.setText("Producao");

        jMInconsistencia.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_P, java.awt.event.InputEvent.CTRL_MASK));
        jMInconsistencia.setMnemonic('P');
        jMInconsistencia.setText("Producao");
        jMInconsistencia.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMInconsistenciaActionPerformed(evt);
            }
        });
        jMenu2.add(jMInconsistencia);

        jMSubMenu.setText("UpLoad");

        jMDecontos.setText("Descontos");
        jMSubMenu.add(jMDecontos);
        jMDecontos.setEnabled(ativo("UpDe"));

        jMCortesias.setText("Cortesias");
        jMSubMenu.add(jMCortesias);
        jMCortesias.setEnabled(ativo("UpCo"));

        jMParticular.setText("Particular");
        jMParticular.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMParticularActionPerformed(evt);
            }
        });
        jMSubMenu.add(jMParticular);
        jMParticular.setEnabled(ativo("UpPa"));

        jMenu2.add(jMSubMenu);

        jMenuBar1.add(jMenu2);

        jMenu3.setText("Administrador");

        jMUser.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_U, java.awt.event.InputEvent.SHIFT_MASK | java.awt.event.InputEvent.CTRL_MASK));
        jMUser.setText("Usuario");
        jMUser.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMUserActionPerformed(evt);
            }
        });
        jMenu3.add(jMUser);
        jMUser.setEnabled(ativo("usua"));
        jMenu3.add(jSeparator1);

        jMAcao.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_A, java.awt.event.InputEvent.SHIFT_MASK | java.awt.event.InputEvent.CTRL_MASK));
        jMAcao.setText("Acao");
        jMAcao.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMAcaoActionPerformed(evt);
            }
        });
        jMenu3.add(jMAcao);
        jMAcao.setEnabled(ativo("acao"));

        jMPerfil.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_G, java.awt.event.InputEvent.SHIFT_MASK | java.awt.event.InputEvent.CTRL_MASK));
        jMPerfil.setText("Grupo de Usuarios");
        jMPerfil.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMPerfilActionPerformed(evt);
            }
        });
        jMenu3.add(jMPerfil);
        jMPerfil.setEnabled(ativo("GuUs"));

        jMenuBar1.add(jMenu3);

        jMenu6.setText("Ajuda");

        jMenuItem2.setText("Atualizar");
        jMenuItem2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem2ActionPerformed(evt);
            }
        });
        jMenu6.add(jMenuItem2);

        jMenuBar1.add(jMenu6);

        setJMenuBar(jMenuBar1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPFundo, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addComponent(jPDisplay, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jPFundo, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGap(0, 0, 0)
                .addComponent(jPDisplay, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jMUnidActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMUnidActionPerformed
        // TODO add your handling code here:
        getU();
    }//GEN-LAST:event_jMUnidActionPerformed

    private void jMConvActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMConvActionPerformed
        // TODO add your handling code here:
        getM();
    }//GEN-LAST:event_jMConvActionPerformed

    private void jMAtenActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMAtenActionPerformed
        // TODO add your handling code here:
        getA();
    }//GEN-LAST:event_jMAtenActionPerformed

    private void jMIncoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMIncoActionPerformed
        // TODO add your handling code here:
        getN();
    }//GEN-LAST:event_jMIncoActionPerformed

    private void jMDeparaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMDeparaActionPerformed
        // TODO add your handling code here:
        getD();
    }//GEN-LAST:event_jMDeparaActionPerformed

    private void jMInconsistenciaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMInconsistenciaActionPerformed
        // TODO add your handling code here:
        getP("");
    }//GEN-LAST:event_jMInconsistenciaActionPerformed

    private void jMUserActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMUserActionPerformed
        // TODO add your handling code here:
        getUs();
    }//GEN-LAST:event_jMUserActionPerformed

    private void jMPerfilActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMPerfilActionPerformed
        // TODO add your handling code here:
       getGu();
    }//GEN-LAST:event_jMPerfilActionPerformed

    private void jMStatusActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMStatusActionPerformed
        // TODO add your handling code here:
        getS();
    }//GEN-LAST:event_jMStatusActionPerformed

    private void jMAcaoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMAcaoActionPerformed
        // TODO add your handling code here:
        getAc();
    }//GEN-LAST:event_jMAcaoActionPerformed

    private void jMParticularActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMParticularActionPerformed
        // TODO add your handling code here:        
        getP("p");
    }//GEN-LAST:event_jMParticularActionPerformed

    private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem2ActionPerformed
        // TODO add your handling code here:
        atualizar();
    }//GEN-LAST:event_jMenuItem2ActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(JFPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(JFPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(JFPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(JFPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new JFPrincipal().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel conexaoLabel;
    private javax.swing.JLabel dataLabel;
    private javax.swing.JMenuItem jMAcao;
    private javax.swing.JMenuItem jMAten;
    private javax.swing.JMenu jMCadastro;
    private javax.swing.JMenuItem jMConv;
    private javax.swing.JMenuItem jMCortesias;
    private javax.swing.JMenuItem jMDecontos;
    private javax.swing.JMenuItem jMDepara;
    private javax.swing.JMenuItem jMInco;
    private javax.swing.JMenuItem jMInconsistencia;
    private javax.swing.JMenuItem jMParticular;
    private javax.swing.JMenuItem jMPerfil;
    private javax.swing.JMenuItem jMStatus;
    private javax.swing.JMenu jMSubMenu;
    private javax.swing.JMenuItem jMUnid;
    private javax.swing.JMenuItem jMUser;
    private javax.swing.JMenu jMenu2;
    private javax.swing.JMenu jMenu3;
    private javax.swing.JMenu jMenu4;
    private javax.swing.JMenu jMenu5;
    private javax.swing.JMenu jMenu6;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JMenuBar jMenuBar2;
    private javax.swing.JMenuItem jMenuItem1;
    private javax.swing.JMenuItem jMenuItem2;
    private javax.swing.JPanel jPDisplay;
    private javax.swing.JPanel jPFundo;
    private javax.swing.JPopupMenu.Separator jSeparator1;
    private javax.swing.JLabel usuarioLabel;
    // End of variables declaration//GEN-END:variables
    
    private static JIAtendente A;
    private static JIMascara M;
    private static JIUnidade U;
    private static JINConformidade N;
    private static JIStatus S;
    private static JIDePara D;
    private static JIProducao P;
    private static JIAcao Ac;
    private static JIUsuario Us;
    private static JIGrupoUsuario Gu;
    private static String conexao; 
    
    private void iniciarComponentes() {
        new Thread(new data()).start();
    }

    public static String getConexao() {
        return conexao;
    }

    public static void setConexao(String conexao) {
        JFPrincipal.conexao = conexao;
    }

    private void atualizar() {
        //executa arquivo MAPEAMENTO
        try {
            // TODO code application logic here
            Runtime.getRuntime().exec("cmd.exe /C start MAPEAMENTO.bat");
            System.out.println("Arquivo MAPEAMENTO.BAT EXECUTADO COM SUCESSO!");
            System.exit(0);
        } catch (IOException ex) {
            JOptionPane.showMessageDialog(null, "ERRO AO ENCONTRAR O ARQUIVO!","ERRO",JOptionPane.ERROR_MESSAGE);
        }
    }
    
    private class data implements Runnable {

        @Override
        public void run() {
            SimpleDateFormat formato = new SimpleDateFormat("dd/MM/yyyy | HH:mm:ss");
            while (true) {
                try {
                    dataLabel.setText(formato.format(new Date()));
                    usuarioLabel.setText("Usuario: " + Sessao.getInstance().getUser().getNome());
                    conexaoLabel.setText("Conexao: " + getConexao());
                    Thread.sleep(1000);                            
                } catch (InterruptedException ex) {
                }
            }
        }
    }
    public void getA() {
        if(A == null){
            A = new JIAtendente();
        }
        jPFundo.add(A);
        A.setVisible(true);
    }

    public static void setA(JIAtendente A) {
        JFPrincipal.A = A;
    }

    public void getM() {
        if (M == null) {
            M = new JIMascara();
        }
        jPFundo.add(M);
        M.setVisible(true);
    }

    public static void setM(JIMascara M) {
        JFPrincipal.M = M;
    }

    public void getU() {
        if(U == null){
            U = new JIUnidade();
        }
        jPFundo.add(U);
        U.setVisible(true);
    }

    public static void setU(JIUnidade U) {
        JFPrincipal.U = U;
    }

    public void getN() {
        if(N == null){
            N = new JINConformidade();
        }
        jPFundo.add(N);
        N.setVisible(true);
    }

    public static void setN(JINConformidade N) {
        JFPrincipal.N = N;
    }

    public void getS() {
        if(S == null){
            S = new JIStatus();
        }
        jPFundo.add(S);
        S.setVisible(true);
    }

    public static void setS(JIStatus S) {
        JFPrincipal.S = S;
    }

    public void getD() {
        if(D == null){
            D = new JIDePara();
        }
        jPFundo.add(D);
        D.setVisible(true);
    }

    public static void setD(JIDePara D) {
        JFPrincipal.D = D;
    }
    
    public void getP(String component){
        if(P == null){
            P = new JIProducao();
        }
        P.setComponent(component);
        jPFundo.add(P);
        P.setVisible(true);
    }
    
    public static void setP(JIProducao P) {
        JFPrincipal.P = P;
    }
    
    public void getAc(){
        if(Ac == null){
            Ac = new JIAcao();
        }
        jPFundo.add(Ac);
        Ac.setVisible(true);
    }
    
    public static void setAc(JIAcao Ac){
        JFPrincipal.Ac = Ac;
    }
    
    public void getUs(){
        if(Us == null){
            Us = new JIUsuario();
        }
        jPFundo.add(Us);
        Us.setVisible(true);
    }
    
    public static void setUs(JIUsuario Us){
        JFPrincipal.Us = Us;
    }
    
    public void getGu(){
        if(Gu == null){
            Gu = new JIGrupoUsuario();
        }
        jPFundo.add(Gu);
        Gu.setVisible(true);
    }
    
    public static void setGu(JIGrupoUsuario Gu){
        JFPrincipal.Gu = Gu;
    }
    
    public static boolean ativo(String internal) {
        List<Acessos> list = Sessao.getInstance().getUser().getGrupoUsuariosId().getAcessosList();
        for (Acessos perm : list) {
            if (perm.hashCode() == internal.hashCode()) {
                return true;
            }
        }
        return false;
    }
}
